<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>充值信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__PUBLIC__/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/layuiadmin/style/admin.css" media="all">
<body layadmin-themealias="default" style="">
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item" style="height: 20px;line-height: 20px;">
                <div class="layui-inline" style="margin-right: 0px;">
                     <span class="layui-breadcrumb">
                        <a href="">首页/充值信息</a>
                        </span>
                </div>
                <div class="layui-inline" style="right: 0px;position: absolute;">
                    <a class="layui-btn layui-btn-small" style="line-height:20px;margin-top:-6px;float:right" href="javascript:location.replace(location.href);" title="刷新">
                        &nbsp; <i class="layui-icon layui-icon-refresh-3" style="line-height:18px;left: 12px;top:12px;"></i> &nbsp;
                    </a>
                </div>
            </div>
        </div>
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline" style="margin-right: 0px;">
                    <div class="layui-input-inline">
                        <input class="layui-input" placeholder="开始日期" name="start_time" id="start" >

                    </div>
                    <div class="layui-input-inline">
                        <input class="layui-input" placeholder="截止日期" name="end_time" id="end">

                    </div>
                    <div class="layui-input-inline">
                        <input type="number" name="gameid"  placeholder="游戏ID/用户ID"  value="{$gameid}"  class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" style="margin-right: 0px;">
                    <div class="layui-input-inline">
                        <select name="channel" class="">
                            <option value="-1">全部渠道</option>
                            <option value="0">支付宝</option>
                            <option value="1">微信</option>
                            <option value="3">代理充值</option>
                            <option value="2">银行卡</option>
                            <option value="5">支付宝快充</option>
                            <option value="6">支付宝微信定额</option>
                        </select>
                    </div>
                </div>

                <div class="layui-inline" style="margin-right: 0px;">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit="" lay-filter="LAY-user-back-search">
                        &nbsp;&nbsp;&nbsp;&nbsp;<i class="layui-icon layui-icon-search"></i>
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <table class="layui-hide" id="admin_table" lay-filter="admin_table"></table>
            <script type="text/html" id="table-sumprice">
                   <span>充值总金额：<b id="sumprice" style="color: red"></b></span>
            </script>

        </div>
    </div>
</div>

<script src="__PUBLIC__/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '__PUBLIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table','laydate'], function(){
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table,laydate = layui.laydate;

        //时间范围
        laydate.render({
            elem: '#start'
            ,type: 'datetime'
        });
        //时间范围
        laydate.render({
            elem: '#end'
            ,type: 'datetime'
        });

        $(".layuiadmin-btn-admin").on("click",function(){
            var startime = $("#start").val();
            var endtime = $("#end").val();
            var channel = $("select[name=channel]").val();
            var gameid = $("input[name=gameid]").val();

            table.reload('admin_table',{
                page:{
                    curr:1
                }
                ,where:{startime:startime,endtime:endtime,channel:channel,gameid:gameid}
            });
        });

        var tradetype = $("select[name=tradetype]").val();

        //执行一个 table 实例
        table.render({
            elem: '#admin_table'
            ,url: '/Bankrecored/getsearch' //数据接口
            ,title: '用户管理'
            ,page: true //开启分页
            ,toolbar: '#table-sumprice' //开启工具栏，此处显示默认图标，可以自定义模板，详见文
            ,defaultToolbar:['filter','exports']
            ,height:650
            ,totalRow:true
            ,cols: [[ //表头
                {field: 'outoid', title: '充值订单'}
                ,{field: 'gameid', title: '游戏ID', width:200}
                ,{field: 'nickname', title: '游戏昵称', width:200}
                ,{field: 'createtime', title: '交易时间',totalRowText:'<span style="color: red">充值总金额（元）</span>'}
                ,{field: 'price', title: '充值金额', width:160,totalRow:true}
                ,{field: 'channelname', title: '支付渠道', width:200}

            ]]
            ,where:{tradetype:tradetype}
            ,done:function (d) {
                $('.layui-table-total .layui-table-cell').css('color','red');
                $('.layui-table-total .layui-table-cell').css('background-color','#05e1ff');
                var sum = d['sumprice'];
                $('#sumprice').text(sum);
            }
        });


        //监听行工具事件
        table.on('tool(admin_table)', function(obj){
            var data = obj.data;
            //console.log(obj)
            if(obj.event === 'recharge'){
                var id = '';
                id = obj.data.gameid;
                layer.open({
                    type: 2,
                    title:'充值信息',
                    skin: 'layui-layer-rim', //加上边框
                    area: ['90%', '90%'], //宽高
                    maxmin:true,
                    content:"/member/messagebuy/gameid/"+id
                });
            } else if(obj.event === 'info'){
                var id = '';
                id = obj.data.gameid;
                layer.open({
                    type: 2,
                    title:'充值信息',
                    skin: 'layui-layer-rim', //加上边框
                    area: ['90%', '90%'], //宽高
                    content:"/member/gameinfo/gameid/"+id
                });

            }else if(obj.event==='details'){
                var id = '';
                id = obj.data.gameid;
                layer.open({
                    type: 2,
                    title:'充值信息',
                    skin: 'layui-layer-rim', //加上边框
                    area: ['90%', '90%'], //宽高
                    content:"/member/messagebunkoall/gameid/"+id
                });
            }
        });
    });
</script>
</body>
</html>